<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserMoneyLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_money_logs', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('order_no',100)->comment('订单号');
            $table->integer('user_id')->comment('客户id');
            $table->integer('player_id')->nullable()->comment('关联玩家id');
            $table->integer('type')->comment('1购买服务器时长 2提现 3玩家充值');
            $table->tinyInteger('trade_type')->comment('1收入 2支出');
            $table->decimal('amount',10,2)->comment('金额');
            $table->decimal('cash_fee',10,2)->default(0)->comment('手续费');
            $table->decimal('after_money')->comment('交易后余额');
            $table->string('info',255)->nullable()->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_money_logs');
    }
}
